/*
 * MT9V032.h
 *
 *  Created on: 2011/09/21
 *      Author: AKS
 */

#ifndef _MT9V032_H_
#define _MT9V032_H_

/***********************************************************************/
/* Device Address on I2C                                               */
/***********************************************************************/
#define S_CTRL_ADR1 0
#define S_CTRL_ADR0 0

#define SLV_ADR_MT9V032 (0x48 | (S_CTRL_ADR1 << 4) | (S_CTRL_ADR0 << 2))


/***********************************************************************/
/* Register Mapping                                                    */
/***********************************************************************/
#define MT9V032_CHIP_VER        0x00 // rev1:0x1311, rev2:0x1311, rev3:0x1313
#define MT9V032_COLUMN_START    0x01 // default: 0x0001(1)
#define MT9V032_ROW_START       0x02 // default: 0x0004(4)
#define MT9V032_WINDOW_HEIGHT   0x03 // default: 0x01E0(480)
#define MT9V032_WINDOW_WIDTH    0x04 // default: 0x02F0(752)
#define MT9V032_HORIZON_BLANK   0x05 // default: 0x005E(94)
#define MT9V032_VERTICAL_BLANK  0x06 // default: 0x002D(45)
#define MT9V032_CHIP_CONTROL    0x07 // default: 0x0388
#define MT9V032_SHUTTER_WIDTH1  0x08 // default: 0x01BB(443)
#define MT9V032_SHUTTER_WIDTH2  0x09 // default: 0x01D9(473)
#define MT9V032_SHUTTER_W_CTRL  0x0A // default: 0x0164
#define MT9V032_TOTAL_SHUTTER_W 0x0B // default: 0x01E0(480)
#define MT9V032_RESET           0x0C // default: 0x0000
#define MT9V032_READ_MODE       0x0D // default: 0x0300
#define MT9V032_MONITOR_MODE    0x0E // default: 0x0000
#define MT9V032_PIXEL_OP_MODE   0x0F // default: 0x0011
/* 0x10 to 0x1A is Reserved */
#define MT9V032_LED_OUT_CTRL    0x1B // default: 0x0000
#define MT9V032_ADC_MODE_CTRL   0x1C // default: 0x0002
/* 0x1D to 0x2B is Reserved */
#define MT9V032_VREF_ADC_CTRO   0x2C // default: 0x0840
/* 0x2D to 0x30 is Reserved */
#define MT9V032_V1              0x31 // default: 0x001D
#define MT9V032_V2              0x32 // default: 0x0018
#define MT9V032_V3              0x33 // default: 0x0015
#define MT9V032_V4              0x34 // default: 0x0014
#define MT9V032_ANALOG_GAIN     0x35 // default: 0x0010
#define MT9V032_MAX_ANALOG_GAIN 0x36 // default: 0x0040
/* 0x37 to 0x41 is Reserved */
#define MT9V032_FRAME_DARK_AVG  0x42 // it's read only
/* 0x43 to 0x45 is Reserved */
#define MT9V032_DARK_AVG_THRES  0x46 // default: 0x231D
#define MT9V032_BL_CALIB_CTRL   0x47 // default: 0x8080
#define MT9V032_BL_CALUB_VALUE  0x48 // default: 0x0000
/* 0x49 to 0x4B is Reserved */
#define MT9V032_BL_CALIB_STEP_SIZE 0x4C // default: 0x0002
/* 0x4D to 0x6F is Reserved */
#define MT9V032_ROW_NOISE_CTRL1 0x70 // default: 0x0034
/* 0x71 is Reserved */
#define MT9V032_ROW_NOISE_CONST 0x72 // default: 0x002A
#define MT9V032_ROW_NOISE_CTRL2 0x73 // default: 0x02F7
#define MT9V032_PCLK_FV_LV      0x74 // default: 0x0000
/* 0x75 to 0x7E is Reserved */
#define MT9V032_TEST_PATTERN    0x7F // default: 0x0000
#define MT9V032_TILE_WEIGHT(x,y) (0x80 + (y*5) + x) // default: 0x00F4
#define MT9V032_TILE_COORDX(n)   (0x99 + n)
#define MT9V032_TILE_COORDY(n)   (0x9F + n)
#define MT9V032_AEC_AGC_BIN     0xA5 // default: 0x003A
#define MT9V032_AEC_UPDATE_FREQ 0xA6 // default: 0x0002
/* 0xA7 is Reserved */
#define MT9V032_AEC_LPF         0xA8 // default: 0x0000
#define MT9V032_AGC_UPDATE_FREQ 0xA9 // default: 0x0002
/* 0xAA is Reserved */
#define MT9V032_AGC_LPF         0xAB // default: 0x0002
/* 0xAC to 0xAE is Reserved */
#define MT9V032_AEC_AGC_ENABLE  0xAF // default: 0x0003
#define MT9V032_AEC_AGC_PIX_CNT 0xB0 // default: 0xABE0
#define MT9V032_LVDS_MSTR_CTRL  0xB1 // default: 0x0002
#define MT9V032_LVDS_SCLK_CTRL  0xB2 // default: 0x0010
#define MT9V032_LVDS_DATA_CTRL  0xB3 // default: 0x0010
#define MT9V032_DATA_LATANCY    0xB4 // default: 0x0000
#define MT9V032_LVDS_INTER_SYNC 0xB5 // default: 0x0000
#define MT9V032_LVDS_PAYLOAD_CN 0xB6 // default: 0x0000
#define MT9V032_STEREO_ERR_CTRL 0xB7 // default: 0x0000
#define MT9V032_STEREO_ERR_FLAG 0xB8 // it's read only
#define MT9V032_LVDS_DATA_OUT   0xB9 // it's read only
#define MT9V032_AGC_GAIN_OUTPUT 0xBA // it's read only
#define MT9V032_AEC_GAIN_OUTPUT 0xBB // it's read only
#define MT9V032_AGC_AEC_CUR_BIN 0xBC // it's read only
#define MT9V032_MAX_SHUT_WIDTH  0xBD // default: 0x01E0
#define MT9V032_AGC_AEC_BIN_DIF 0xBE // default: 0x0014
#define MT9V032_FIELD_BLANK     0xBF // default: 0x0016
#define MT9V032_MON_MODE_CAP    0xC0 // default: 0x000A
#define MT9V032_TEMPERTURE      0xC1 // it's read only
#define MT9V032_ANALOG_CTRLS    0xC2 // default: 0x0840
#define MT9V032_NTSC_H_BLNK_CTL 0xC3 // default: 0x3840
#define MT9V032_NTSC_V_BLNK_CTL 0xC4 // default: 0x4416
/* 0xC6 to 0xEF is Reserved */
#define MT9V032_BYTEWISE_ADDR   0xF1 // default: 0x4421
/* 0xF2 to 0xFD is Reserved */
#define MT9V032_REGISTER_LOCK   0xFE // default: 0xBEEF
#define MT9V032_VHIP_VER2       0xFF //


#endif/*_MT9V032_H_*/
